package com.av.bcacc.jetpack.modle.databinding;

import androidx.databinding.ObservableField;

/**
 * @description 双向绑定观察者类
 * @author weiliang hu
 * @time 2021/5/12 21:45
 * @email:2072025612@qq.com
 */

public class TwoWayBindingViewModel {
    private ObservableField<LoginUser>loginUserObservableField;
    public TwoWayBindingViewModel(){
        LoginUser loginUser=new LoginUser();
        loginUser.setPhone("1388383838");
        loginUser.setPasswd("xxxxxx");
        loginUserObservableField=new ObservableField<>();
        loginUserObservableField.set(loginUser);
    }
    public String getPhone(){
      return  loginUserObservableField.get().getPhone();
    }

    public void setPhone(String phone){
        loginUserObservableField.get().setPhone(phone);
    }

    public String getPasswd(){
        return  loginUserObservableField.get().getPasswd();
    }

    public void setPasswd(String passwd){
        loginUserObservableField.get().setPasswd(passwd);
    }
}
